package com.hdu.controller.searchManagement;

import com.hdu.dto.SearchCourseParamDto;
import com.hdu.pojo.CourseIndex;
import com.hdu.pojo.Result;
import com.hdu.service.CourseSearchService;
import com.hdu.vo.SearchPageResultDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 课程搜索接口
 *
 * @author xiaobai
 * @since 2024-05-20
 */

@RestController
@RequestMapping("/course")
@Api(value = "课程搜索接口", tags = "课程搜索接口")
public class CourseSearchController {

    @Autowired
    CourseSearchService courseSearchService;


    @ApiOperation("课程搜索列表")
    @GetMapping("/list")
    public Result<SearchPageResultDto<CourseIndex>> list(@RequestParam(defaultValue = "1") Integer current,
                                                         @RequestParam(defaultValue = "5") Integer size,
                                                         SearchCourseParamDto searchCourseParamDto) {

        return Result.success(courseSearchService.queryCoursePubIndex(current, size, searchCourseParamDto));

    }
}
